package com.hkccommunity.mapper;

import com.hkccommunity.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;



public interface UserMapper {

    @Select("select * from user where phone = #{phone} and `delete` = 0;")
    @ResultMap("userResultMap")
    User getUserByPhone(@Param("phone") String phone);

    @Select("select * from user where id = #{id};")
    @ResultMap("userResultMap")
    User getUserById(@Param("id") Long id);

    @Insert("insert ignore into user values (#{id},#{username},#{password},#{phone},#{headImage},#{admin},#{delete})")
    int insertUser(User user);

}
